<?php

declare(strict_types=1);

use Hyperf\Database\Seeders\Seeder;
use Hyperf\DbConnection\Db;
use Plugin\Gq\VideoMonitoring\Model\GqVideoType;

class GqVideoCameraSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $type = GqVideoType::create([
            'name' => '默认',
        ]);

        $cameras = [
            [
                'name' => '大门入口摄像头',
                'type' => $type->id,
                'short_name' => '大门摄像头',
                'device_code' => 'CAM001',
                'device_serial' => 'HK2023001',
                'manufacturer' => '海康威视',
                'ip_address' => '192.168.1.101',
                'port' => 554,
                'username' => 'admin',
                'password' => 'admin123',
                'play_url' => 'rtsp://admin:admin123@192.168.1.101:554/h264/ch1/main/av_stream',
                'location' => '大门入口处',
                'longitude' => 116.404269,
                'latitude' => 39.913164,
                'status' => 1,
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => '停车场监控摄像头',
                'type' => $type->id,
                'short_name' => '停车场摄像头',
                'device_code' => 'CAM002',
                'device_serial' => 'DH2023002',
                'manufacturer' => '大华',
                'ip_address' => '192.168.1.102',
                'port' => 554,
                'username' => 'admin',
                'password' => 'admin123',
                'play_url' => 'rtsp://admin:admin123@192.168.1.102:554/cam/realmonitor?channel=1&subtype=0',
                'location' => '停车场A区',
                'longitude' => 116.405269,
                'latitude' => 39.914164,
                'status' => 1,
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => '办公区走廊摄像头',
                'type' => $type->id,
                'short_name' => '走廊摄像头',
                'device_code' => 'CAM003',
                'device_serial' => 'YS2023003',
                'manufacturer' => '萤石',
                'ip_address' => '192.168.1.103',
                'port' => 554,
                'username' => 'admin',
                'password' => 'admin123',
                'play_url' => 'rtsp://admin:admin123@192.168.1.103:554/live',
                'location' => '一楼办公区走廊',
                'longitude' => 116.406269,
                'latitude' => 39.915164,
                'status' => 0,
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ],
        ];

        Db::table('gq_video_camera')->insert($cameras);
    }
}
